package com.dc.controller;

import com.dc.annotation.Log;
import com.dc.common.ResponseResultVO;
import com.dc.entity.ro.FireWorkOrderRO;
import com.dc.entity.vo.FireVO;
import com.dc.feign.DeviceApiServiceFeign;
import com.dc.service.FireWorkOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@Api(tags = "火警处置工单管理")
@RestController
@RequestMapping("/fireWorkOrder")
public class FireWorkOrderController {

    @Resource
    private FireWorkOrderService fireWorkOrderService;

    @Log(title = "火警处置工单管理", businessDesc = "增加工单")
    @ApiOperation(value = "增加", notes = "增加")
    @PostMapping("/insertFireWorkOrder")
    public ResponseResultVO insertFireWorkOrder(@RequestBody FireWorkOrderRO ro) {
        return fireWorkOrderService.insertFireWorkOrder(ro);
    }


    @Log(title = "火警处置工单管理", businessDesc = "修改工单")
    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("/updateFireWorkOrder")
    public ResponseResultVO updateFireWorkOrder(@RequestBody FireWorkOrderRO ro) {
        return fireWorkOrderService.updateFireWorkOrder(ro);
    }


    @Log(title = "火警处置工单管理", businessDesc = "删除工单")
    @ApiOperation(value = "删除", notes = "删除")
    @GetMapping("/deleteFireWorkOrder")
    public ResponseResultVO deleteFireWorkOrder(@RequestParam String id) {
        return fireWorkOrderService.deleteFireWorkOrder(id);
    }

    @ApiOperation(value = "查询列表", notes = "查询列表")
    @PostMapping("/selectFireWorkOrderList")
    public ResponseResultVO<FireVO> selectFireWorkOrderList(@RequestBody FireWorkOrderRO ro) {
        return fireWorkOrderService.selectFireWorkOrderList(ro);
    }

    @ApiOperation(value = "列表导出", notes = "列表导出")
    @PostMapping("/fireWorkOrderRecordExport")
    public void fireWorkOrderRecordExport(HttpServletResponse response, @RequestBody FireWorkOrderRO ro) {
        fireWorkOrderService.fireWorkOrderRecordExport(response, ro);
    }

}
